home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group93b.txt
/
000098_icon-group-sender _Thu May 13 14:46:25 1993.msg
< prev
next >
Wrap
Internet Message Format
|
1993-06-16
|
4KB
Received: from owl.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 17 May 1993 07:43:38 MST
Received: by owl.cs.arizona.edu; Mon, 17 May 1993 07:43:37 MST
Date: 13 May 93 14:46:25 GMT
From: agate!howland.reston.ans.net!ux1.cso.uiuc.edu!uchinews!ellis!goer@ucbvax.Berkeley.EDU (Richard L. Goerwitz)
Organization: University of Chicago
Subject: Re: Icon vs Prolog, docs, availability ?
Message-Id: <1993May13.144625.16769@midway.uchicago.edu>
References: <borbor-130593120939@129.194.82.105>
Sender: icon-group-request@cs.arizona.edu
To: icon-group@cs.arizona.edu
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
borbor@divsun.unige.ch (Boris Borcic) writes:
>
>For instance, it is at times desirable to constrain the
>search for further solutions in a way that depends on the
>solutions already found. IMHO, the declarative leaning of Prolog's
>backtracking makes this difficult and unnatural to program.
>Does Icon let me do this naturally ?
This is the main advantage of Icon, and its disadvantage (rela-
tive to Prolog). Icon is not an attempt at instantiating first-
order predicate logic. It is not pure in this respect. Yet it
includes all of the mechanisms one would need to do this: It
has control and optional data backtracking, and can handle prob-
lems without any notion of assignment. You can write programs
that function solely by something analogous to term unification,
and the like.
The fact that Icon is not pure makes it easier to cheat, if you
are so inclined. I.e. there are operators that limit the amount
of backtracking. For example, if I take a string like "hellolo,"
and ask for the position of every "l" in it, I might say:
"hellolo" ? every write(find("l"))
The question mark says "we're going to work on the preceding
string." This expression will write 3, 4, and 6. But let's say
we only want two results. We can cheat:
"hellolo" ? every write(find("l")) \ 2
Now if you want to check earlier results, Icon has a more Algol-
ish exterior than Prolog. You can assign variables explicitly,
much as you would in Pascal:
"hellolo" ? {
every i := find("l") do {
if i = 6 then next
else write(i)
}
}
This will have the same effect as saying
"hellolo" ? every write(find("l")) \ 2
I.e. it will write only 3 and 4, but not 6.
Personally, my favorite part of Icon is string scanning. It is,
in a way, syntactic sugar. But there are aspects of it that make
it uniquely elegant. The ? marker sets up a string as the object
of a scanning expression, and you can then do lots of neat things
to that string. The scanning expression is a kind of control
structure, so you can break out of it or return, and its environ-
ments are handled correctly. There's not much point in explaining
it, though, until you've looked at a textbook and tried it out.
If you had a whiff of Snobol, I guess it's probably broadly simi-
lar.
>Some FAQs : Is there an Icon Bible ? Internet on-line docs ?
>Public domain implementations ? For what systems ?
The main archive site is cs.arizona.edu, and you'll find lots of
interesting PD implementations there for most popular systems, and
porting instructions for the unpopular ones :-). The main text-
book is Griswold & Griswold _The Icon Programming Language_ (Pren-
tice Hall, c. 1989).
Enjoy. If you have X or OS/2, try enabling the visual interface.
If you're using UNIX and are interested in a bit of experimentation,
try the (still a bit experimental) compiler as well.
--
-Richard L. Goerwitz goer%midway@uchicago.bitnet
goer@midway.uchicago.edu rutgers!oddjob!ellis!goer